 <%=render :partial => "/frame_top" %>
 <% @multimedia = TempPhoto.new %>
<div id="photos_uploaded"></div>
  <% form_for(@multimedia, :url => upload_multimedias_path, :html => {:multipart => true}) do |f| %>
    <h1>Upload Photos</h1>
    <input type='file' id='upload' />
    <a href="javascript:$('#upload').uploadifyUpload();">Upload</a>
  <% end 
  session_key_name = ActionController::Base.session_options[:key] %>
  <script type="text/javascript">
    jQuery(function(){

      var selector = '#upload';
      jQuery(selector).uploadify({
	  	'uploader' : '/jquery.uploadify/uploadify.swf',
      	'cancelImg' : '/jquery.uploadify/cancel.png',
	  	'buttonText' : 'Add Photos',	
	  	'fileExt' : '*.jpg;*.gif;*.png;*.jpeg',
	  	'fileDesc' : 'Only images',
	    'script' : '<%=url_for(:action => :upload_photo)%>',
	    'multi' : true,
		'onComplete' : function(){ 
			$('<div style="display:none;font-size:40px;background-color:red"></div>').appendTo('#photos_uploaded').load('/multimedias/get_last_photo', null, function(){$('#photos_uploaded div:hidden:first').fadeIn(1000);});			
		},
		'scriptData': { 
			'authenticity_token': encodeURIComponent('<%=u form_authenticity_token if protect_against_forgery? %>'), 
			'<%= session_key_name %>': '<%=u cookies[session_key_name] %>' 
		}       
	  	
	  });

    });

  </script> 
 <%=render :partial => "/frame_bottom" %>